package Exercise;

import java.util.Scanner;

/**
 * Description：
 * Author: zhangc
 * Date：2017/8/10 15:31
 */
public class ShufflePocker {


    public static int[] shufflePockerKTimes(int[] array, int length, int times) {
        if (length <= 0)
            return array;
        int[] arr = shufflePocker(array, length);
        for (int i = 1; i < times; i++) {
            arr = shufflePocker(arr, length);
        }
        return arr;
    }

    private static int[] shufflePocker(int[] array, int length) {
        int index = 1, temp;
        for (int i = (length >> 1); i < length; i++) {
            temp = array[ i ];
            for (int j = i; j > index; --j) {
                array[ j ] = array[ j - 1 ];
            }
            array[ index ] = temp;
            index += 2;
        }
        return array;
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int group = scanner.nextInt();
        int n, times;
        int[] arr, result;
        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < group; i++) {
            n = scanner.nextInt();
            arr = new int[ n ];
            times = scanner.nextInt();
            for (int j = 0; j < n; j++) {
                arr[ j ] = scanner.nextInt();
            }
            result = shufflePockerKTimes(arr, n, times);
            sb.delete(0, sb.capacity() - 1);
            for (int anInt : result) {
                sb.append(" " + anInt);

            }
            System.out.println(sb.toString().trim());
        }
    }
}
